Skip to content

HHH-19365 GaussDB Dialect Support #10199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

liubao68
Copy link

@liubao68 liubao68 commented May 22, 2025

As discussed, move new Dialect Support to community.

see old PR to core #10093


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-19365

@liubao68 liubao68 changed the title [HHH-19365]GaussDB Dialect Support HHH-19365 GaussDB Dialect Support May 22, 2025
@liubao68
Copy link
Author

Everything is ready for review

@liubao68
Copy link
Author

Build and test:

./docker_db.sh gaussdb
./gradlew build -Pdb=gaussdb -DdbHost=localhost:8000

BUILD SUCCESSFUL in 25m 56s

@quaff
Copy link
Contributor

quaff commented May 22, 2025

IMHO, the GaussDB Dialect should extends PostgreSQL Dialect to reuse code as possible, not to duplicate all related sources.

@liubao68
Copy link
Author

liubao68 commented May 22, 2025

IMHO, the GaussDB Dialect should extends PostgreSQL Dialect to reuse code as possible, not to duplicate all related sources.

Actually, GaussDB has many different features than PostgreSQL and now the tested mode is Oracle compatibility . In future, GaussDB will not compatible with PostgreSQL but with OpenGauss. And a separation of code may help us testing and add new features.

Your suggestion is quite good for less code duplication. But there are some potential risks. For example, a contributor modified PostgreSQL related code will influence GaussDB, however, Hibernate community is not respnosible for fixing problems in community dialect.

int count = 0;
for ( int i = 0; i < size; i++ ) {
final ValuedModelPart modelPart = getEmbeddedPart( embeddableMappingType, orderMapping[i] );
if ( modelPart.getMappedType() instanceof EmbeddableMappingType embeddableMappingType ) {

Check notice

Code scanning / CodeQL

Possible confusion of local and field Note

Confusing name: method
getJdbcValueSelectable
also refers to field
embeddableMappingType
(without qualifying it with 'this').
return DateTimeFormatter.ISO_LOCAL_TIME.parse( subSequence, LocalTime::from );
}

private Object parseTimestamp(CharSequence subSequence, JavaType<?> jdbcJavaType) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'jdbcJavaType' is never used.
return rawJdbcValue.toString();
}

protected <X> String toString(X value, JavaType<X> javaType, WrapperOptions options) throws SQLException {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'javaType' is never used.
case SqlTypes.DECIMAL:
case SqlTypes.NUMERIC:
case SqlTypes.DURATION:
appender.append( subValue.toString() );

Check warning

Code scanning / CodeQL

Dereferenced variable may be null Warning

Variable
subValue
may be null at this access as suggested by
this
null guard.
Variable
subValue
may be null at this access as suggested by
this
null guard.
);
break;
case SqlTypes.UUID:
appender.append( subValue.toString() );

Check warning

Code scanning / CodeQL

Dereferenced variable may be null Warning

Variable
subValue
may be null at this access as suggested by
this
null guard.
Variable
subValue
may be null at this access as suggested by
this
null guard.
new TemplatedViolatedConstraintNameExtractor( sqle -> {
final String sqlState = JdbcExceptionHelper.extractSqlState( sqle );
if ( sqlState != null ) {
switch ( Integer.parseInt( sqlState ) ) {

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
/**
* Allow for extension points to override this only
*/
protected void contributeGaussDBTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'serviceRegistry' is never used.
private static final String XML_QUERY_SEPARATOR = "' passing ";
private static final String XML_QUERY_END = " columns v xml path '.')t)";

public static AggregateSupport valueOf(Dialect dialect) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'dialect' is never used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants